
{% extends TEMPLATE_BASE %}
{% block title %}{{election.name}}{% endblock %}
{% block content %}
<div style="float: left; margin-right: 50px;">
  <h3 class="title">{{ election.name }}
{% if admin_p %}
{% if not election.frozen_at %}
<small><a class="small button" href="{% url "election@edit" election.uuid %}">修改</a></small>
{% endif %}
{% endif %}</h3>
<p style="padding-top:0px; margin-top:0px">
<em>{% if election.private_p %}私有{%else%}公开{% endif %}</em> {{ election.election_type }}{% if settings.SHOW_USER_INFO %} created by <u><b>{{election.admin.display_html_small|safe}}</b></u>{% endif %}
{% if election.is_archived %}
[archived]
{% endif %}
{% if admin_p %}
&nbsp;{% if election.is_archived %}<a class="small button" href="{% url "election@archive" election_uuid=election.uuid %}?archive_p=0">不归档</a>{% else %}<a class="small button" href="{% url "election@archive" election_uuid=election.uuid %}?archive_p=1">归档</a>{% endif %}
<a class="small button" onclick="return window.confirm('Are you sure you want to copy this election?');" href="{% url "election@copy" election_uuid=election.uuid %}">拷贝</a>
{% endif %}
<br />
{% if admin_p %}
{% if not election.private_p %}
{% if election.featured_p %}
 {{election.election_type}} 在前页中已定义.
{% if can_feature_p %}
[<a href="{% url "election@set-featured" election.uuid %}?featured_p=0">取消定义</a>]
{% endif %}
{% else %}
 {{election.election_type}} <u>没有</u> 在前页中被定义.
{% if can_feature_p %}
[<a href="{% url "election@set-featured" election.uuid %}?featured_p=1">定义</a>]
{% endif %}
{% endif %}
{% endif %}
{% endif %}
</p>

</div>


<br />

<br clear="left" />

<div style="margin-bottom: 25px; line-height: 1.3;">
{{election.description_bleached|safe}}
</div>

<p>
{% if election.help_email and admin_p%}获取帮助邮箱地址: {{election.help_email}}<br />{% endif %}
{% if election.voting_start_at %}投票于 {{election.voting_start_at}} 开始<br />{% endif %}
{% if election.voting_end_at %}投票于 {{election.voting_end_at}} 结束<br />{% endif %}
</p>

{% if election.election_info_url %}
<p style="font-size:1.5em;">[<a target="_blank" href="{{election.election_info_url}}" rel="noopener noreferrer">download candidate bios &amp; statements</a>]</p>
{% endif %}

<p align="center" style="font-size: 1.5em;">
<a href="{% url "election@questions" election.uuid %}">问题项 ({% if election.questions %}{{election.questions|length}}{% else %}0{% endif %})</a>
&nbsp;&nbsp;|&nbsp;&nbsp;
<a href="{% url "election@voters@list-pretty" election.uuid %}">选民 &amp; 选票</a>
&nbsp;&nbsp;|&nbsp;&nbsp;
<a href="{% url "election@trustees@view" election.uuid %}">监管者 ({{trustees|length}})</a>
</p>

{% if admin_p %}
{% if election.frozen_p %}
<div style="background: lightyellow; padding:5px; padding-left: 10px; margin-top: 15px; border: 1px solid #aaa; width: 720px;" class="round">
<a href="#" onclick="$('#badgebody').slideToggle(250);">Embed an Election Badge</a>
<div id="badgebody" style="display:none;">
<br />
<form action="#">
<textarea cols="90" rows="4" wrap="soft">&lt;iframe src="{{election_badge_url}}" frameborder="0" style="border: 1px solid black" height="75" width="200"&gt;
&lt;/iframe&gt;</textarea><br />
<p style="font-size:0.8em;">adding this HTML to your site displays a thin banner with direct links to voting.</p>
</form>
</div>
</div>
{% endif %}
<p>

{% if election.result_released_at %}

<!-- election complete, no next step -->

{% else %}
<b>Next Step:</b>
<span style="font-size: 1.3em;">
{% if not election.frozen_at %}
{% if election.issues_before_freeze %}
{% for issue in election.issues_before_freeze %}
{{issue.action}}{% if forloop.last %}{% else %}, and{% endif %}<br />
{% endfor %}
{% else %}
<a href="{% url "election@freeze" election.uuid %}">冻结选票并开启选举.</a>
<br />
{% if election.voting_starts_at %}
完成此操作后，选举将准备好投票，并<br />
在 {{election.voting_starts_at}}, 根据您的设置自动开始.
{% else %}
一旦你这样做，选举将立即开放投票.
{% endif %}
{% endif %}

{% else %}

{% if not election.encrypted_tally %}
{% if election.tallying_started_at %}
完全统计正在进行中.<br />
请稍等几分钟刷新此页面.
{% else %}
<a href="{% url "election@compute-tally" election.uuid %}">计算加密计数</a><br />
加密的投票将被合成一个加密的计票，一旦完成,<br />
受委托人将被要求提供他们的解密密钥.
{% endif %}
{% else %}

{% if election.result %}
<a href="{% url "election@release-result" election.uuid %}">公布结果</a><br />
此结果只对您自己开放.<br />
一旦您开放此次选举结果，那么所有人都将知晓.
{% else %}

{% if election.ready_for_decryption_combination %}
<a href="{% url "election@combine-decryptions" election.uuid %}">
{% if election.num_trustees == 1 %}
计算结果
{% else %}
结合监管者密钥并计算投票结果
{% endif %}
</a><br />
{% if election.num_trustees == 1 %}
结果即将被计算并且展示给身为管理员的您.
{% else %}
来自监管者的解密密钥将会被合并然后进行计算.<br />
执行此操作后，只有管理员才能看到计数.
{% endif %}
{% else %}
<a href="{% url "election@trustees@view" election.uuid %}">监管者（用于解密）</a>
{% endif %}

{% endif %}

{% endif %}

{% endif %}
</span>

{% endif %}

</p>

{% endif %}

<br />

{% if show_result %}
{% if election.result_released_at %}
<span class="highlight-box round">
    本次选举已圆满结束.
</span><br /><br /><br />
{% endif %}

<h3 class="highlight-box">Tally</h3>
{% for question in election.pretty_result %}
<b><span style="font-size:0.8em;">Question #{{forloop.counter}}</span><br />{{question.question}}</b><br />
<table class="pretty" style="width: auto;">
{% for answer in question.answers %}
<tr><td style="padding-right:80px;{% if answer.winner %}font-weight:bold;{% endif %}">{{answer.answer}}</td><td align="right" style="{% if answer.winner %}font-weight:bold;{% endif %}">{{answer.count}}</td></tr>
{% endfor %}
</table>
{% endfor %}

{% else %}

{% if election.voting_has_stopped %}
<span class="highlight-box round">
    选举已关闭，结果即将公布.
</span><br /><br />
{% else %}

{% if election.voting_has_started %}
<a class="button" href="{{test_cookie_url}}">Vote in this {{election.election_type}} </a>
<br />
<br />
{% if election.voting_extended_until %}
此选举 {{election.election_type}} 最初计划在 {{election.voting_ends_at}} (UTC) 结束,<br />
但现在被延迟至 {{ election.voting_extended_until }} (UTC) 结束.
{% else %}
{% if election.voting_ends_at %}
<br />
此选举 {{election.election_type}} 计划在 {{election.voting_ends_at}} (UTC) 结束.
{% else %}
此选举 {{election.election_type}} 由管理员自行决定结束.
{% endif %}
<br />
{% endif %}

{% if election.private_p and voter %}
<br />
此选举是 <em>私有的</em>. 您以合格选民身份登录为 <em>{{voter.name}}</em>.
{% endif %}

<div class="highlight-box round" style="font-size: 1.2em; margin-right: 400px; display:none;" id="nojava_message">
  You do not have Java installed in your browser.<br />At this time, Helios requires Java.<br />
  Visit <a target="_new" href="http://java.sun.com">java.sun.com</a> to install it.
</div>
<br />
{% else %}
<span class="highlight-box round">
  选举暂未开启
</span> <br /><br />
{% endif %}

{% if user %}
{% if voter %}
<p style="padding-top:1px;">
  您已登记在此投票 {{election.election_type}}.
{% if election.use_voter_aliases %}
您的选民别称是 {{voter.alias}}.
{% endif %}
</p>

{% else %}
{% if election.result %}
{% else %}
{% if election.openreg %}
{% if eligible_p %}
您有资格在此选举中进行投票.
{% else %}
您 <em>没有资格</em> 在此选举 {{election.election_type}} 中投票.
{% endif %}
{% else %}
您 <em>没有资格</em> 在此选举 {{election.election_type}} 中投票.
<br />
{% endif %}
{% endif %}
{% endif %}
{% else %}

{% if election.openreg %}
{% if election.eligibility %}
This election is open to: {{election.pretty_eligibility|safe}}
<a href="{{settings.SECURE_URL_HOST}}{% url "auth@index" %}?return_url={{CURRENT_URL}}">登录</a> 检查是否有资格.
{% else %}
任何人都可以在此次选举中投票.
{% endif %}
{% endif %}

{% endif %}

{% endif %}

{% endif %}

{% if admin_p and election.voting_ends_at and not election.tallying_started_at %}
<br /><a href="{% url "election@extend" election.uuid %}">投票延期</a><br />
{% endif %}

<div style="background: lightyellow; padding:5px; padding-left: 10px; margin-top: 15px; border: 1px solid #aaa;" class="round">
<a href="#" onclick="$('#auditbody').slideToggle(250);">审计信息</a>
<div id="auditbody" style="display:none; word-wrap: break-word;">
<br />投票链接:<br />
<a href="{{election.url}}">{{election.url}}</a>

{% if election.frozen_at %}
<br />
<br />选举身份码:<br />
<tt style="font-size: 1.3em; font-weight: bold;">{{election.hash}}</tt>


{% if votes %}
<p>您的投票跟踪器:<br />
<tt style="font-size:14pt; font-weight: bold;">{{votes.0.vote_hash}}</tt>
</p>
{% endif %}

<p style="font-size: 1.3em;">
<a href="{% url "election@voters@list-pretty" election.uuid %}">选票追踪中心</a> &nbsp;| &nbsp;
<a href="{% url "election@audited-ballots" election.uuid %}">审计选票</a>
</p>

{% endif %}

{% if not election.voting_has_started %}
<p style="font-size: 1.2em;">
  <br>
  <a href="{{SECURE_URL_HOST}}/booth/vote.html?election_url={% url "election@home" election.uuid %}">预览</a>
</p>
{% endif %}

{% if election.voting_has_stopped %}
<p style="font-size: 1.2em;">
{% if election.result %}
验证 <a target="_blank" href="/verifier/verify.html?election_url={% url "election@home" election.uuid %}"> 选举统计</a>.
{% endif %}

查看 <a href="{{vote_url}}">投票</a>.
</p>

{% endif %}

</div>
</div>




{% endblock %}
